<html>
<head><meta charset="utf-8"><title>C ABI static libs · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/C.20ABI.20static.20libs.html">C ABI static libs</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="209472724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/C%20ABI%20static%20libs/near/209472724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gray Jack <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/C.20ABI.20static.20libs.html#209472724">(Sep 09 2020 at 05:16)</a>:</h4>
<p>Hi y'all!! I have a question and I think it belongs on t-compiler/help</p>
<p>If I have 2 static libraries that only expose thing in the C ABI and each one is compiled with different versions of rustc, do I encounter symbol problems trying to link both into a C binary?</p>



<a name="209483653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/C%20ABI%20static%20libs/near/209483653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/C.20ABI.20static.20libs.html#209483653">(Sep 09 2020 at 08:24)</a>:</h4>
<p>All mangled symbols have a hash that depends on the compiler version. There are a few unmangled symbols in compiler_builtins, but those should only pulled from one of the static libs by the linker. Which one doesn't matter, as they have fixed semantics required by LLVM. In fact the linker may use the compiler_builtins implementation for normal C programs (<code>libgcc_s</code>?) instead. There also some unmangled symbols exported by libcore, libpanic_* and libstd (starting with <code>__rdl_</code>, <code>__rg_</code> and <code>__rust_</code>) for for example panic handling and allocating. I don't know if there will be a conflict there. You could try it.</p>



<a name="209593112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/C%20ABI%20static%20libs/near/209593112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gray Jack <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/C.20ABI.20static.20libs.html#209593112">(Sep 10 2020 at 03:38)</a>:</h4>
<p>Thanks!!! I'll certainly try those cases where you're not sure</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>